|
In computer science, the Boyer–Moore string search algorithm is an efficient string searching algorithm that is the standard benchmark for practical string search literature. It was developed by Robert S. Boyer and J Strother Moore in 1977.〔 〕 The algorithm preprocesses the string being searched for (the pattern), but not the string being searched in (the text). It is thus well-suited for applications in which the pattern is much shorter than the text or where it persists across multiple searches. The Boyer-Moore algorithm uses information gathered during the preprocess step to skip sections of the text, resulting in a lower constant factor than many other string algorithms. In general, the algorithm runs faster as the pattern length increases. The key features of the algorithm are to match on the tail of the pattern rather than the head, and to skip along the text in jumps of multiple characters rather than searching every single character in the text. ==Definitions== * ''S''() denotes the character at index ''i'' of string ''S'', counting from 1. * ''S''() denotes the substring of string ''S'' starting at index ''i'' and ending at ''j'', inclusive. * A ''prefix'' of ''S'' is a substring ''S''() for some ''i'' in range (''n'' ), where ''n'' is the length of ''S''. * A ''suffix'' of ''S'' is a substring ''S''() for some ''i'' in range (''n'' ), where ''n'' is the length of ''S''. * The string to be searched for is called the ''pattern'' and is denoted by ''P''. Its length is ''n''. * The string being searched in is called the ''text'' and is denoted by ''T''. Its length is ''m''. * An ''alignment'' of ''P'' to ''T'' is an index ''k'' in ''T'' such that the last character of ''P'' is aligned with index ''k'' of ''T''. * A ''match'' or ''occurrence'' of ''P'' occurs at an alignment if ''P'' is equivalent to ''T''(). 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Boyer–Moore string search algorithm」の詳細全文を読む スポンサード リンク
|